package com.egg.basic.service.pay;

import com.egg.basic.entity.pay.PayRecord;
import com.egg.basic.enums.pay.ClientTypeEnum;
import com.egg.basic.enums.pay.PayTypeEnum;
import com.egg.common.mybatis.service.IBaseService;

import java.io.Serializable;
import java.util.Optional;


public interface IPayRecordService extends IBaseService<PayRecord> {

    /**
     * 查询支付成功的记录
     *
     * @param businessType
     * @param businessId
     * @return
     */
    Optional<PayRecord> findSuccess(String businessType, Serializable businessId);

    /**
     * 查询待支付的支付记录
     *
     * @param businessType
     * @param businessId
     * @return
     */
    Optional<PayRecord> findWait(String businessType, Serializable businessId);

    /**
     * 发起支付
     *
     * @param payType
     * @param clientType
     * @param businessId
     * @param uerId
     * @param amount
     * @param subject
     * @return 支付的url
     */
    String add(
            PayTypeEnum payType
            , ClientTypeEnum clientType
            , String businessType
            , String businessId
            , Optional<Long> uerId
            , Long amount
            , String subject
    );

}
